<template>
  <a-checkbox-group
    :value="value"
    :options="options"
    :disabled="disabled"
    @change="onChange"
  >
    <template v-slot="{ item }">
      <slot name="label" v-bind:item="item"> </slot>
    </template>
    <slot />
  </a-checkbox-group>
</template>

<script>
export default {
  name: 'DCheckboxGroup',
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: Array,
      default: () => []
    },
    disabled: {
      type: Boolean,
      default: false
    },
    options: {
      type: Array
    }
  },
  methods: {
    onChange(e) {
      this.$emit('change', e);
      this.$emit('update:value', e);
    }
  }
};
</script>

<style lang="scss" scoped></style>
